package string;

import java.util.Arrays;

/*
String [] split (String regex):拆分
将当前字符串按照满足正则表达式(regex)的部分进行拆分,将拆分出的以String[]形式返回
 */
public class SplitDemo {
    public static void main(String[] args) {
        String line ="abc123def456ghi";
        String [] date=line.split("[0-9]+");
        for (int i = 0; i <date.length ; i++) {
            System.out.println(date[i]);
        }

        line="123.456.78";
        date=line.split("\\.");
        System.out.println(Arrays.toString(date));
        System.out.println(date.length);


        line=".123.456..78.....";
        date=line.split("\\.");
        System.out.println(Arrays.toString(date));
        System.out.println(date.length);




    }
}
